package com.jankins.pat;

import java.util.Scanner;

public class NumberCategory {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int group = in.nextInt();

            // input the consecutive numbers
            int[] num = new int[group];
            for(int i = 0; i < group; i++) {
                num[i] = in.nextInt();
            }

            int a1 = 0;  // the A1: the sum of all even numbers divisible by 5
            int a2 = 0;  // the A2: the interleaved sum of numbers divisible by 1 by 5
            boolean flag = true;  
            int a3 = 0;  // the A3: the count of the numbers divisible by 2 by 5
            float a4 = 0.0f;  // A4: the average number of the number divisible by 3 by 5
            int sum = 0;
            int a5 = 0;       // A5: the max number divisble by 4 by 5
            for(int i = 0; i < group; i++) {
                // A1
                if(num[i] % 5 == 0 && num[i] % 2 == 0) {
                    a1 += num[i];
                }

                // A2
                if((num[i]-1) % 5 == 0) {
                    if(flag) {
                        a2 += num[i];
                        flag = false;
                    } else {
                        a2 -= num[i];
                        flag = true;
                    }
                }

                // A3
                if((num[i] - 2) % 5 == 0) {
                    a3++;
                }

                // A4
                if((num[i] - 3) % 5 == 0) {
                    a4 += num[i];  // Just make the sum
                    sum++;
                }

                //  a5
                if((num[i] - 4) % 5 == 0) {
                    if(num[i] > a5)
                        a5 = num[i];
                }
            }

            // make the output format correct.
            if(a1 != 0) {
                System.out.printf("%d ", a1);
            } else {
                System.out.print("N ");
            }

            if(a2 != 0) {
                System.out.printf("%d ", a2);
            } else {
                System.out.print("N ");
            }

            if(a3 != 0) {
                System.out.printf("%d ", a3);
            } else {
                System.out.print("N ");
            }

            if(a4 != 0) {
                System.out.printf("%.1f ", a4/sum);
            } else {
                System.out.print("N ");
            }

            if(a5 != 0) {
                System.out.printf("%d", a5);
            } else {
                System.out.print("N");
            }

        }
    }
}
